import Vue from "vue";
import Vuex from "vuex";
import { SET_COUNT } from "./types";
// import axios from "axios";
import articlesModule from "./modules/articels.module";
import todolistModule from "./modules/todolist.module";
import artsModule from "./modules/arts.module";
Vue.use(Vuex);

const store = new Vuex.Store({
  state: {
    count: 0
  },
  getters: {
    count100(state) {
      return state.count * 100;
    }
  },
  mutations: {
    [SET_COUNT](state, data) {
      state.count += data;
    }
  },
  actions: {
    setCount(context, options) {
      // const {commit} = context
      console.log(options);
      context.commit("SET_COUNT", options);
    }
  },
  modules: {
    articlesModule,
    todolistModule,
    artsModule
  },
  strict: true
});

export default store;
